<!DOCTYPE html>
<html>
<head>
	<meta charset="utf-8">
	<title>发布主题信息</title>
	<style type="text/css">
	body{
		
		background-color: white;
	}
	#mainform{
		text-align:left;
		font-size: 20px;
		background-color: white;
		height: 500px;
		float: left;
		width: 60%;
		padding: 10px;
		border-right: 1px solid #4a5259;
		margin-right: 20px;
		margin-left: 20px;
	}
	#gonggaolianjie{
		
		background-color: #ffffff;
		float: left;
		width: 35%;
		min-height: 500px;
	}
	#gonggaolianjie h2{
		color: red;
	}
	#gonggaolian h2{
		float: left;
	}
	#gonggaolian a{
		float: right;
	    line-height: 70px;
	    margin-right: 50px;
	}
	#frame{
		border-top: 1px solid #4a5259;
		border-bottom: 1px solid #4a5259;
	}
	a{
		text-decoration: none;
		color: black;
	}
	a:hover{
		text-decoration: underline;
	}
	ul{
		list-style: none;
	}
</style>
</head>
<body>
<!--header信息-->
<?php
include_once("header.php");
?>
<!--发布主题中间显示内容-->
<div id="mainform">
<form action="" method="post">
标题:<input type="text" name="title"  style="width: 200px;height: 30px;"><br/><br/>
分类:<select name="type"  style="width: 200px;height: 30px;">
<option value="需求分析">需求分析</option>
<option value="错误反馈">错误反馈</option>
</select>
<br/><br/>
描述:<br/>
<textarea name="description" rows="15" cols="80" placeholder="请输入内容"></textarea>
<br/><br/>
<input type="submit" name="submit" value="点击发布" style="width: 100px;height: 30px;display: block;margin-left: 250px;">
</form>
</div>
<?php
if(isset($_POST["submit"])&&$_POST["submit"]=="点击发布"){
	$subjectid=time();
	$title=$_POST["title"];
	$type=$_POST["type"];
	date_default_timezone_set("Asia/Shanghai");
	$dates=date("Y-m-d H:m:s");
	$description=$_POST["description"];
	$questioner=$_COOKIE["username"];//这里从cookie里获取登陆用户姓名
	$type=$_POST["type"];
	//写入到数据库subject表
	$insertintosubject="insert into subject(subjectid,title,type,description,dates,questioner,answers) values('$subjectid','$title','$type','$description','$dates','$questioner',0)";
	include_once("database.php");
	mysql_query($insertintosubject) or die("用户发表主题失败:".mysql_error()."<br/>");
	//跳转到主界面
	header("Refresh:2;url=index.php");
}
?>
<!--机房公告和友情链接-->
<div id="gonggaolianjie">
	<div id="gonggaolian">
		<h2>机房公告</h2>
		<?php 
		include_once("database.php");
		if(isset($_COOKIE["type"])&&$_COOKIE["type"]=="管理员") {
				echo '<a href="fabugonggao.php" >发布</a>';
			}
		?>
		

	</div>
	
	<iframe src="gonggao.php" name="iframe_main" id="frame" frameborder="0" width="100%" height="200">
		如果看到此处内容,则说明浏览器版本过低,升级浏览器即可!
	</iframe>
	<div id="gonggaolian">
	<h2>友情链接</h2>
	<?php 
		include_once("database.php");
		if(isset($_COOKIE["type"])&&$_COOKIE["type"]=="管理员") {
				echo '<a href="fabulink.php" >发布</a>';
			}
		?>
	</div>
	<iframe src="link.php" name="iframe_main" id="frame" frameborder="0" width="100%" height="200">
		如果看到此处内容,则说明浏览器版本过低,升级浏览器即可!
	</iframe>
</div>
<!--加载底部信息-->
<?php
include_once("footer.php");
?>
</body>
</html>